package org.zero.concurrency.demo.example.mq;

import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @program: concurrency-demo
 * @description: 发送消息
 * @author: 01
 * @create: 2018-10-22 20:16
 **/
@Component
public class RabbitMqClient {
    private final RabbitTemplate rabbitTemplate;

    @Autowired
    public RabbitMqClient(RabbitTemplate rabbitTemplate) {
        this.rabbitTemplate = rabbitTemplate;
    }

    public void sender(String message) {
        rabbitTemplate.convertAndSend(QueueConstants.TEST, message);
    }
}
